class Solution {
public:
    bool isPalindrome(string s) {
        string a;
        for (int i = 0; i < s.length(); i++) {
            if (s[i] >= 'A' && s[i] <= 'Z' || s[i] >= 'a' && s[i] <= 'z' || s[i] >= '0' && s[i] <= '9') {
                a += tolower(s[i]);
            }
        }
        string newa;
        for (int i = a.length() - 1; i >= 0; i--) {
            newa += a[i];
        }
        if (a == newa) { return true; }
        else { return false; }
    }
};